"""
Jiraiya Renamer and Scraper
copyright Artur Figueira 2011 
http://www.arturfigueira.com

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.

Jiraiya is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this Jiraiya.  If not, see <http://www.gnu.org/licenses/>.
"""
from utils.Renamer import Renamer
from utils.Scraper import Scraper
class Jiraiya(object):
    
    def __init__(self, tvdbCode):
        self.__tvdbCode = tvdbCode
                
    def renameAndScrape(self, sourceDir, destDir=None, extensions=None, deepSearch = True, force = False):
        self.rename(sourceDir, destDir, extensions, deepSearch)
        scrapeDir = destDir if destDir is not None else sourceDir
        self.scrape(scrapeDir, extensions, force)
        
    def rename(self, sourceDir, destDir=None, extensions=None, deepSearch = True):
        renamer = Renamer(sourceDir, destDir, extensions)
        if not deepSearch:
            renamer.disabledeepSearch()
        renamer.rename()
        
    def scrape(self, sourceDir, extensions=None, force = False):
        scraper = Scraper(sourceDir, self.__tvdbCode, extensions)
        scraper.setForce(force)
        scraper.scrap()       